var express = require('express');
var router = express.Router();
const { uploadFiles } = require('../utils/handleFiles.js');
/* GET home page. */
//二级接口
//新增专业
router.post('/uploadImages', function(req, res, next) {
    const uploadResult = uploadFiles({
        path: './public/images', //设置上传成功后的图片存储路径‘
        key: 'file',
        size: 10000
    })
    uploadResult(req, res, error => {
        if (error) {
            console.log('图片上传失败', error);
        } else {
            console.log('图片上传成功', req.files);
            res.send({
                code: 1,
                message: '图片上传成功',
                result: 'images/' + req.files[0].filename
            })
        }
    })
});


module.exports = router;